package com.yingxin.yx.framework.security.pwd;

import com.yingxin.yx.framework.encrpty.pwd.Sha1Encrpty;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @author fanchao
 */
// @Component
public class Sha1PasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence charSequence) {
        return Sha1Encrpty.encryptPassword(charSequence.toString());
    }

    @Override
    public boolean matches(CharSequence charSequence, String s) {
        return Sha1Encrpty.validatePassword(charSequence.toString(), s);
    }
}
